package com.thinktank.controller;

import static com.thinktank.util.DbUtil.*;

import java.io.*;
import java.sql.*;
import java.util.List;

import javax.servlet.*;
import javax.servlet.http.*;

import com.thinktank.vo.*;
import com.thinktank.dao.*;

public class BoardDetailController implements Controller {
	public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String bNo = request.getParameter("bNo");
		System.out.println(bNo);
		Connection con = getConnection();
		BoardDao dao = new BoardDao(con);	
		Board board = dao.getBoard(bNo);
		if(board != null){
			List<Reply> list = dao.getAllReplies(bNo);
			System.out.println("BNO LIST 성공");
			request.setAttribute("board", board);
			if(list != null)	request.setAttribute("list", list);
			
			AlbumDao dao2 = new AlbumDao(con);
			List<Album> alist = dao2.getBDFiles(bNo);
			if(alist != null)	request.setAttribute("files", alist);
		}
		close(con);
		
		// reply 수정
		
		return "boardDetail.jsp";		
	}
}
